//
//  FMAudioPlayer.h
//  AudioProgress
//
//  Created by 赵成峰 on 2018/8/31.
//  Copyright © 2018年 赵成峰. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, FMAudioPlayerOptionFlag) {
    FMAudioPlayerOptionFlagOriginal,//原声
    FMAudioPlayerOptionFlagLolita,  //萝莉
    FMAudioPlayerOptionFlagThriller,//惊悚
    FMAudioPlayerOptionFlagUncle,   //大叔
    FMAudioPlayerOptionFlagFunny,   //搞怪
    FMAudioPlayerOptionFlagVacant,  //空灵
    FMAudioPlayerOptionFlagRobot,   //机器人
    FMAudioPlayerOptionFlagChorus,  //合唱
};

@interface FMAudioPlayerOption : NSObject

@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) FMAudioPlayerOptionFlag flag;

+ (NSArray<FMAudioPlayerOption *> *)defaultOptions;

@end

@protocol FMAudioPlayerDelegate <NSObject>
@optional
/**
 *  曲目播放完成通知
 */
- (void)trackPlayDidEnd;
/**
 *  播放进度
 */
-(void)timeRunScale:(CGFloat)scale;

@end

@interface FMAudioPlayer : NSObject

@property (nonatomic, assign) CGFloat pitch;
@property (nonatomic, assign) NSInteger type;
@property (nonatomic, weak) id<FMAudioPlayerDelegate> delegate;

- (instancetype)initWithPath:(NSString *)path;
- (instancetype)initWithPath:(NSString *)path option:(FMAudioPlayerOption *)option;

- (void)play;
- (void)play_ready;
- (void)start;
- (void)startWithPitch;
- (void)startWithStyle;
- (void)pause;
- (void)stop;
- (void)save:(NSString *)outPath pitch:(CGFloat)pitch complete:(void (^)(BOOL success))success;
- (void)save:(NSString *)outPath volume:(CGFloat)volume complete:(void (^)(BOOL success))success;
- (void)save:(NSString *)outPath type:(NSInteger)type complete:(void (^)(BOOL success))success;

- (int)get_total_seconds;
- (void)set_current_pos:(int)position;
- (void)set_volume:(float)volume;
@end
